package com.oco.tools.stopwatch;

import org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * Spring 方法拦截器配置
 * @author ZhiHong Zhang
 * @email it_javasun@yeah.net
 * @sine 下午3:09:19
 */
@Configuration
public class StopWatchMethodTimeConfig {

	//使用BeanNameAutoProxyCreator来创建代理  
    @Bean  
    public BeanNameAutoProxyCreator beanNameAutoProxyCreator(){  
        BeanNameAutoProxyCreator beanNameAutoProxyCreator=new BeanNameAutoProxyCreator();  
        //设置要创建代理的那些Bean的名字   可以是*Controller、*ServiceImpl、*Mapper
        beanNameAutoProxyCreator.setBeanNames("*ServiceImpl", "*CalculatePointService", "*TransformOrderSearch",
        		"*OrderSearch","*SearchIndexTemplate");  
        //设置拦截链名字(这些拦截器是有先后顺序的)  
        beanNameAutoProxyCreator.setInterceptorNames("methodTimeAdvice");  
        return beanNameAutoProxyCreator;  
    }  

}